# Contributor: Alex Yam <alex@alexyam.com>
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
pkgname=libplacebo
pkgver=6.338.1
pkgrel=0
# rc testing
_pkgver=${pkgver/_/-}
pkgdesc="Reusable library for GPU-accelerated video/image rendering"
url="https://code.videolan.org/videolan/libplacebo"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	glslang-dev
	glslang-static
	lcms2-dev
	libdovi-dev
	meson
	py3-glad
	py3-mako
	shaderc-dev
	spirv-tools-dev
	vulkan-loader-dev
	"
subpackages="$pkgname-dev"
source="https://code.videolan.org/videolan/libplacebo/-/archive/v$_pkgver/libplacebo-v$_pkgver.tar.gz"
builddir="$srcdir/libplacebo-v$_pkgver"

build() {
	CFLAGS="$CFLAGS -O2" \
	CXXFLAGS="$CXXFLAGS -O2" \
	abuild-meson \
		-Db_lto=true \
		-Dbackend_max_links=4 \
		-Ddemos=false \
		-Ddovi=enabled \
		-Dglslang=enabled \
		-Dlcms=enabled \
		-Dlibdovi=enabled \
		-Dshaderc=enabled \
		-Dtests="$(want_check && echo true || echo false)" \
		-Dvulkan=enabled \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
a538a26552bda77af98264abde0e721c967f0c5eba73c0ffdff3cc7f52a4505ee5b618b99884becf502546261ff6e48881900ce7c782c5495ee3a6728dca9eb1  libplacebo-v6.338.1.tar.gz
"
